Skip to main content

Bug Tracker

Side navigation

Ticket #4391: Has Selector Test.html
File Has Selector Test.html, 1.0 KB (added by beaugunderson, March 19, 2009 11:01PM UTC)

Bug repreoduction

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>jQuery :has() selector test</title>
    
    <script type="text/javascript" lang="javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>
    
    <script type="text/javascript" lang="javascript">
     $(document).ready(function () {
	 // Test A - passes
	 $("#test_li").after('<li><a href="#">Test A failed.</a></li>');
	 $("#test_li").next(":has(a)").text("Test A worked.");
	 
	 // Test B - fails
	 $("#test_li_3").after('<li><a href="#">Test B failed.</a></li>');
	 $("#test_li_2").next(":has(a)").text("Test B worked.");
     });
    </script>
  </head>
  <body>
   <ul id="test_ul">
    <li>a</li>
    <li id="test_li">b</li>
    <li>c</li>
    <li>d</li>
    <li id="test_li_2">e</li>
    <li>f</li>
    <li id="test_li_3">g</li>
    <li>h</li>
    <li>i</li>
   </ul>
  </body>
</html>

Download in other formats:

Original Format